package me.jiatao.wan.ui.main.project

import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import me.jiatao.wan.data.network.pojo.CategoryTreePojo

/**
 * @Author: taojia
 * @CreateDate: 2021/8/31 6:34 下午
 * @Version: 1.0
 * @Description:
 */

class ProjectViewPagerAdapter(
    fragment: Fragment,
    private val categoryTreeList: List<CategoryTreePojo>
) : FragmentStateAdapter(fragment) {

    override fun createFragment(position: Int): Fragment {
        val courseId = categoryTreeList[position].id
        return ArticleListFragment.newInstance(courseId)
    }

    override fun getItemCount(): Int {
        return categoryTreeList.size
    }
}